package com.renren.rrwx.model;

import java.util.HashMap;
import java.util.Random;

import android.graphics.Bitmap;
import android.util.Log;

/**
 * 表示一个玩家英雄的基类
 * 
 * @author Leon
 */
public class Hero {

	public static String TAG = "Hero";
	/**
	 * 初始化一个英雄，至少包含了Name和 ID
	 */

	public long id;
	public String name;
	// 性别,0男，1女
	private String gender = "男";

	public void setGender(String g) {
		gender = g;
	}

	public String getGender() {
		return gender;
	}

	// 头像地址
	private String headImgUrl = "";

	public void setHeadImgUrl(String url) {
		LOGD("hea url=" + url);
		headImgUrl = url;
	}

	public Bitmap getHeadImg() {
		return null;
	}

	// 称号
	private String title = "初入江湖";

	public String getTitle() {
		return "称号:" + title;
	}

	// 门派
	private String school = "少林派";

	public String getSchool() {
		return "门派:" + school;
	}

	// 排名
	private int rank = 250;

	public void setRank(int r) {
		rank = r;
	}

	public String getRank() {
		return "排名:" + rank;
	}

	// 状态
	private int stateNow = 0;

	public String getStateNow() {
		return "状态:" + "无所事事";
	}

	// 属性
	// private int hp, mp, atk, def, agi;
	public static String HP = "体力";
	public static String MP = "内力";
	public static String ATK = "攻击";
	public static String DEF = "防御";
	public static String AGI = "敏捷";
	private HashMap<String, Integer> propMap;

	public String getProp(String key) {
		if (propMap.containsKey(key))
			return key + ":" + propMap.get(key);
		else
			return "";
	}

	public void initProp() {
		propMap = new HashMap<String, Integer>();
		Random rand = new Random();
		propMap.put(HP, rand.nextInt(1000));
		propMap.put(MP, rand.nextInt(500));
		propMap.put(ATK, rand.nextInt(150));
		propMap.put(DEF, rand.nextInt(10));
		propMap.put(AGI, rand.nextInt(50));
	}

	// 描述
	private String discribe = "";

	public String getDiscribe() {
		discribe = name + "，" + this.getGender() + ", 是个初入江湖的小虾米！";
		return discribe;
	}

	/**
	 * Hero的构造方法
	 * 
	 * @param id
	 * @param name
	 */
	Hero(long id, String name) {
		// 生成Hero属性
		this.id = id;
		this.name = name;
		this.initProp();
	}

	@Override
	public String toString() {
		return this.getRank() + " " + name;
	}

	public void LOGD(String msg) {
		Log.d(TAG, msg);
	}

}
